<?php

class Kd_Html_Navigation extends Kd_Html_Element {

    private $_items = array();

    public function __construct() {
        parent::__construct();
        $this->templateName = 'navigation';
    }

    public function getItems(){
        return $this->_items;
    }

    public function addLabel($text){
        $result = new Kd_Html_Element_Label();
        $result->setText($text);
        $this->_items[] = $result;
        return $this;
    }


    public function addLink($text, $href, $target = ''){
        $result = new Kd_Html_Element_Link();
        $result->setText($text)->setHref($href)->setTarget($target);
        $this->_items[] = $result;
        return $this;
    }

    protected function render() {
        $result = '<ul' . $this->getAttributeHtml() . '>';
        foreach ($this->getItems() as $item) {
            $result .= '<li>' . $item->toHtml() . '</li>';
        }
        return $result . '</ul>';
    }
}